<?php

/**
 * Created by PhpStorm.
 * User: CFH
 * Date: 2017/3/30
 * Time: 19:07
 */
class about_mdl extends Model
{
    public static $table = 'mac_about';


    public function add_about($id = 1, $src){
        $rs = $this->get_about($id);
        if(empty($rs['id'])){
            dump(1,$rs);
            $tags = $this->dbh->insert(self::$table, array(
                'src' => $src
            ));
            $rs = $this->dbh->insert_id();
        }else{
            $this->dbh->update(self::$table,
                array(
                    'src' => $src
                ),
                'id='.$rs['id']
            );
        }
        $rs = $this->get_about($id);

        return $rs;
    }


    public function get_about($id = 1){
        $r = '';
        if(!empty($id)){
            $sql = 'SELECT *
					FROM '.self::$table.'
					WHERE id = '.$id;
            $r = $this->dbh->get_one($sql);
        }
        return $r;
    }

}